<?php
namespace app\api\controller;
use app\common\BaseController;
use app\api\model\InsurePersonal as InsurePersonalModel;

class InsurePersonal extends BaseController{
    public function __construct(InsurePersonalModel $insurePersonalModel){
        parent::__construct();
        $this->model = $insurePersonalModel;
    }
    
    public function index(){
        $params = $this->request->param();
        $data = $this->model->allowField(true)->allList($params);
        return $data;
    }
   //添加
   public function create(){
    $param = $this->request->param();      

    $data = $this->model->allowField(true)->isUpdate(false)->save($param);
    return $this->model;
}
//更新
public function update(){
    $param = $this->request->param(); 
    $data = $this->model->allowField(true)->isUpdate(true)->save($param);   
    return $this->model;
}
//删除
public function delete(){
    $params = $this->request->param();   
    $data = $this->model->allowField(true)->where('id',$params['id'])->delete();   
    return $data;
}
}
